//
//  ZHAnchorCollectionViewCell.m
//  XMLYFM
//
//  Created by dllo on 16/1/5.
//  Copyright © 2016年 zzl. All rights reserved.
//

#import "ZHAnchorCollectionViewCell.h"
#import "AppTools.h"
#import "Masonry.h"
//#import "UIButton+WebCache.h"
#import "UIImageView+WebCache.h"

@interface ZHAnchorCollectionViewCell ()

@property (nonatomic,strong)UIImageView *itemImageView;
@property (nonatomic,strong)UILabel *itemTitle;

@end

@implementation ZHAnchorCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
    
}
- (void)createView{
    
    //
    _itemImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_itemImageView];
    
    _itemTitle = [AppTools creatLabelWithfont:17 numberLine:0 textAlignment:NSTextAlignmentCenter];
    _itemTitle.numberOfLines = 0;
    [self.contentView addSubview:_itemTitle];
    
    [_itemImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(@10);
        make.width.mas_equalTo((SCREEN_WIDTH_ZH - 50) / 3);
        make.height.mas_equalTo(@100);
        
    }];
    [_itemTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_itemImageView.mas_bottom);
        make.width.equalTo(_itemImageView);
        make.height.equalTo(@40);
        make.left.equalTo(_itemImageView);
    }];
    _itemImageView.backgroundColor = [UIColor redColor];
    _itemTitle.backgroundColor = [UIColor grayColor];
}

- (void)setModel:(ZHListModel *)model{
   
    _model = model;
    [_itemImageView sd_setImageWithURL:[NSURL URLWithString:model.smallLogo] placeholderImage:PLACEHOLDER_IMAGE];
    _itemTitle.text = model.nickname;
}


@end
